package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.domain.Travel;
import cn.wolfcode.trip.base.query.TravelQueryObject;
import cn.wolfcode.trip.base.service.ITravelService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/travelRelease")
public class TravelReleaseController {

    @Autowired
    private ITravelService travelService;

    @RequestMapping("/list")
    public String getTravels(Model model, @ModelAttribute("qo")TravelQueryObject qo){

        qo.setState(Travel.STATE_RELEASE);
        qo.setOrderBy("t.releaseTime desc");
        qo.setIsPublic(true);
        model.addAttribute("result",travelService.query(qo));
        return "travelRelease/list";
    }

}
